<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="6.5.1">
  <bpmn:collaboration id="Collaboration_0memx95">
    <bpmn:participant id="Participant_1c0lpx5" processRef="Process_1hf9394" />
  </bpmn:collaboration>
  <bpmn:process id="Process_1hf9394" isExecutable="true">
    <bpmn:documentation>Demo Model, to show: \n User Tasks \n Conditional Flow
Gateways</bpmn:documentation>
    <bpmn:laneSet id="LaneSet_15ojlwy">
      <bpmn:lane id="Lane_0ehtkwq" name="Mechanic">
        <bpmn:flowNodeRef>task_repair</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="Lane_0k86xca" name="Driver">
        <bpmn:flowNodeRef>gateway_2</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>task_Drive</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>gateway_1</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Event_19ebav7</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>StartEvent_158yep3</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>task_Buy</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="Lane_1eq1can" name="Cleaner">
        <bpmn:flowNodeRef>task_clean</bpmn:flowNodeRef>
      </bpmn:lane>
    </bpmn:laneSet>
    <bpmn:sequenceFlow id="flow_start_buy" sourceRef="StartEvent_158yep3" targetRef="task_Buy" />
    <bpmn:sequenceFlow id="flow_repair_gw2" sourceRef="task_repair" targetRef="gateway_2" />
    <bpmn:sequenceFlow id="flow_gw1_repair" sourceRef="gateway_1" targetRef="task_repair">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression" language="JavaScript">(item.data.needsRepairs=="Yes")</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:userTask id="task_clean" name="Clean">
      <bpmn:incoming>flow_gw1_clean</bpmn:incoming>
      <bpmn:outgoing>flow_clean_gw2</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:parallelGateway id="gateway_2">
      <bpmn:incoming>flow_repair_gw2</bpmn:incoming>
      <bpmn:incoming>flow_clean_gw2</bpmn:incoming>
      <bpmn:incoming>flow_gw1_gw2</bpmn:incoming>
      <bpmn:outgoing>flow_gw2_drive</bpmn:outgoing>
    </bpmn:parallelGateway>
    <bpmn:userTask id="task_Drive" name="Drive" camunda:candidateUsers="$data.starterUserId" camunda:dueDate="P10D" camunda:followUpDate="P5D">
      <bpmn:incoming>flow_gw2_drive</bpmn:incoming>
      <bpmn:outgoing>flow_drive_end</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:inclusiveGateway id="gateway_1" default="flow_gw1_gw2">
      <bpmn:incoming>flow_buy_gw</bpmn:incoming>
      <bpmn:outgoing>flow_gw1_repair</bpmn:outgoing>
      <bpmn:outgoing>flow_gw1_clean</bpmn:outgoing>
      <bpmn:outgoing>flow_gw1_gw2</bpmn:outgoing>
    </bpmn:inclusiveGateway>
    <bpmn:endEvent id="Event_19ebav7">
      <bpmn:incoming>flow_drive_end</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="flow_gw1_clean" sourceRef="gateway_1" targetRef="task_clean">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression" language="JavaScript">(item.data.needsCleaning=="Yes")</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="flow_clean_gw2" sourceRef="task_clean" targetRef="gateway_2" />
    <bpmn:sequenceFlow id="flow_gw1_gw2" sourceRef="gateway_1" targetRef="gateway_2" />
    <bpmn:sequenceFlow id="flow_gw2_drive" sourceRef="gateway_2" targetRef="task_Drive" />
    <bpmn:sequenceFlow id="flow_drive_end" sourceRef="task_Drive" targetRef="Event_19ebav7" />
    <bpmn:sequenceFlow id="flow_buy_gw" sourceRef="task_Buy" targetRef="gateway_1" />
    <bpmn:startEvent id="StartEvent_158yep3" name="Start Event" camunda:initiator="starterUserId" camunda:candidateUsers="Ralph" camunda:candidateGroups="drivers">
      <bpmn:documentation>Buy a Used Car, Starting the process</bpmn:documentation>
      <bpmn:extensionElements>
        <camunda:executionListener event="end">
          <camunda:script scriptFormat="JavaScript">data.startDate=this.endedAt;</camunda:script>
        </camunda:executionListener>
      </bpmn:extensionElements>
      <bpmn:outgoing>flow_start_buy</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:userTask id="task_Buy" name="Buy" camunda:assignee="$(this.userId)" camunda:dueDate="$this.dueDate">
      <bpmn:extensionElements>
        <camunda:formData>
          <camunda:formField id="needsRepairs" label="Repairs Required?" type="enum" defaultValue="No">
            <camunda:properties>
              <camunda:property id="Property_20jsiiu" />
            </camunda:properties>
            <camunda:value id="Yes" name="Yes" />
            <camunda:value id="No" name="No" />
          </camunda:formField>
          <camunda:formField id="needsCleaning" label="Cleaning Required?" type="enum" defaultValue="No">
            <camunda:value id="Yes" name="Yes" />
            <camunda:value id="No" name="No" />
          </camunda:formField>
        </camunda:formData>
        <camunda:executionListener event="start">
          <camunda:script scriptFormat="JavaScript">var date=new Date();
date.setDate(date.getDate()+5);
this.dueDate=date.toISOString();</camunda:script>
        </camunda:executionListener>
      </bpmn:extensionElements>
      <bpmn:incoming>flow_start_buy</bpmn:incoming>
      <bpmn:outgoing>flow_buy_gw</bpmn:outgoing>
    </bpmn:userTask>
    <bpmn:userTask id="task_repair" name="Repair">
      <bpmn:incoming>flow_gw1_repair</bpmn:incoming>
      <bpmn:outgoing>flow_repair_gw2</bpmn:outgoing>
    </bpmn:userTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0memx95">
      <bpmndi:BPMNShape id="Participant_1c0lpx5_di" bpmnElement="Participant_1c0lpx5" isHorizontal="true">
        <dc:Bounds x="152" y="53" width="808" height="403" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Lane_1eq1can_di" bpmnElement="Lane_1eq1can" isHorizontal="true">
        <dc:Bounds x="182" y="346" width="778" height="110" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Lane_0k86xca_di" bpmnElement="Lane_0k86xca" isHorizontal="true">
        <dc:Bounds x="182" y="186" width="778" height="160" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Lane_0ehtkwq_di" bpmnElement="Lane_0ehtkwq" isHorizontal="true">
        <dc:Bounds x="182" y="53" width="778" height="133" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="flow_buy_gw_di" bpmnElement="flow_buy_gw">
        <di:waypoint x="390" y="256" />
        <di:waypoint x="431" y="256" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="314" y="141" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_drive_end_di" bpmnElement="flow_drive_end">
        <di:waypoint x="840" y="256" />
        <di:waypoint x="882" y="256" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="737" y="141" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_gw2_drive_di" bpmnElement="flow_gw2_drive">
        <di:waypoint x="711" y="256" />
        <di:waypoint x="740" y="256" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="614" y="141" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_gw1_gw2_di" bpmnElement="flow_gw1_gw2">
        <di:waypoint x="481" y="256" />
        <di:waypoint x="661" y="256" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="466" y="141" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_clean_gw2_di" bpmnElement="flow_clean_gw2">
        <di:waypoint x="600" y="396" />
        <di:waypoint x="686" y="396" />
        <di:waypoint x="686" y="281" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="546" y="201" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_gw1_clean_di" bpmnElement="flow_gw1_clean">
        <di:waypoint x="456" y="281" />
        <di:waypoint x="456" y="396" />
        <di:waypoint x="500" y="396" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="366" y="199" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_gw1_repair_di" bpmnElement="flow_gw1_repair">
        <di:waypoint x="456" y="231" />
        <di:waypoint x="456" y="160" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="366" y="109" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_repair_gw2_di" bpmnElement="flow_repair_gw2">
        <di:waypoint x="506" y="120" />
        <di:waypoint x="686" y="120" />
        <di:waypoint x="686" y="231" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="546" y="71" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="flow_start_buy_di" bpmnElement="flow_start_buy">
        <di:waypoint x="258" y="256" />
        <di:waypoint x="290" y="256" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="190" y="141" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Activity_1kzuj3t_di" bpmnElement="task_clean">
        <dc:Bounds x="500" y="356" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_0jp9aj3_di" bpmnElement="gateway_2">
        <dc:Bounds x="661" y="231" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="581" y="191" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_02ehn3y_di" bpmnElement="task_Drive">
        <dc:Bounds x="740" y="216" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="InclusiveGateway_0ea77jj_di" bpmnElement="gateway_1">
        <dc:Bounds x="431" y="231" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="306" y="191" width="90" height="12" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_19ebav7_di" bpmnElement="Event_19ebav7">
        <dc:Bounds x="882" y="238" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="771" y="184" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_158yep3">
        <dc:Bounds x="222" y="238" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="213" y="281" width="56" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1bp4iyj_di" bpmnElement="task_Buy">
        <dc:Bounds x="290" y="216" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0pn5s0l_di" bpmnElement="task_repair">
        <dc:Bounds x="406" y="80" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
